package org.wycash.Test;

import static org.junit.Assert.*;

import org.junit.BeforeClass;
import org.junit.Test;
import org.wycash.object.Bank;
import org.wycash.object.Expression;
import org.wycash.object.Money;
import org.wycash.object.Sum;

public class Times {

	@Test
	public void testSumtimes() {
		Expression fiveBucks = Money.dollar(5);
		Expression tenFrancs = Money.franc(10);
		
		Bank bank = new Bank();
		bank.addRate("CHF", "USD", 2);
		
		Expression sum = new Sum(fiveBucks, tenFrancs).times(2);
		Expression result = bank.reduce(sum, "USD");
		assertEquals(result, Money.dollar(20));
	}

}
